package site.wlwsjsx.iot_backend.entity;

import java.util.Date;

/**
 * 用户信息实体类
 * 对应数据库表：user_info
 * 该类使用Lombok的@Getter和@Setter注解自动生成getter和setter方法
 */
public class UserInfo {
    /**
     * 用户唯一ID
     * 主键，自增长
     */
    private Integer id;

    /**
     * 登录账号（学生用学号，管理员用工号）
     * 唯一，不可重复
     */
    private String username;

    /**
     * 加密后的密码（建议BCrypt加密）
     * 存储加密后的密码，不存储明文
     */
    private String password;

    /**
     * 盐值
     * 用于密码加密，增强安全性
     */
    private String salt;

    /**
     * 真实姓名
     * 用户真实姓名
     */
    private String realName;

    /**
     * 角色：1=学生，2=管理员
     * 用于区分用户权限
     */
    private Integer role;

    /**
     * 联系电话
     * 用于用户联系和验证
     */
    private String phone;

    /**
     * 邮箱
     * 用于用户联系和验证
     */
    private String email;

    /**
     * 逻辑删除标识：0=正常，1=删除
     * 使用逻辑删除而非物理删除
     */
    private Boolean isDeleted;

    /**
     * 创建时间
     * 记录用户信息创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     * 记录用户信息最后更新时间
     */
    private Date updateTime;

    public UserInfo() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Boolean getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Boolean deleted) {
        isDeleted = deleted;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "UserInfo{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                ", realName='" + realName + '\'' +
                ", role=" + role +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", isDeleted=" + isDeleted +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
